
<?php
	class LoginView {
	  
	  	private $m_username = 'username';
		private $m_password = 'password';
		private $m_loginButton = 'loginButton';
		private $m_logoutButton = 'logoutButton';
		private $m_checkButton = 'checkButton';
		
		
		  //Funktion som returnerar HTML för ett inloggningsformulär
		  public function DoLoginBox() {
		    return 
		    '<form method="get">
			    <fieldset>
					Name: <input type="text" name="'.$this->m_username.'" /><br />
					Password: <input type="text" name="'.$this->m_password.'" /><br />
					<input type="submit" value="Login" name="'.$this->m_loginButton.'"/>
					Remember me<input type="checkbox" value="Remember me" name="'.$this->m_checkButton.'"/>
				</fieldset>
			</form>';
		  }
		  
		  public function DoLogoutBox() {
		  	return 
		  	'<form name="input" method="get">
		  		<input type="submit" value="Logout" name="'.$this->m_logoutButton.'" />
		  	</form>';
		  }
		  
		  public function GetUserName() {
		  	//returnerar en sträng med det som användaren skrivit
		  	if (isset($_GET[$this->m_username]) == true) {
		  		return $_GET[$this->m_username] ;
		  		
			}
			else {
				return null;
			}
		  }
		  
		  public function GetPassword() {
		  	//returnerar en sträng med det som användaren skrivit
		  	if (isset($_GET[$this->m_password]) == true) {
		  		return $_GET[$this->m_password];
		  		
			}
			else {
				return null;
			}
		  }
		  
		  public function TriedToLogIn() {
		  	
		  	if (isset($_GET[$this->m_loginButton]) == true) {
		  		return true;
		  		
			}
			else {
				return false;
			}
		  }
		  
		  public function TriedToLogOut() {
		  	
		  	if (isset($_GET[$this->m_logoutButton]) == true) {
		  		return true;
		  		
			}
			else {
				return false;
			}
		  }
		  
	}
